class OrderExamination < ActiveRecord::Base

  hobo_model # Don't put anything above this

  fields do
    examination_number :integer
    timestamps
  end

   belongs_to :patient
   belongs_to :examination_type


  # --- Validation --- #
  validates_presence_of :examination_number
  validates_numericality_of :examination_number


  # --- Permissions --- #

  def create_permitted?
    acting_user.recepcionista?
  end

  def update_permitted?
    acting_user.recepcionista?
  end

  def destroy_permitted?
    acting_user.recepcionista?
  end

  def view_permitted?(field)
    acting_user.recepcionista? || acting_user.diagnosta? || acting_user.technik?
  end

end
